package cn.iocoder.yudao.module.hs.dal.mysql.qchistory;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.hs.dal.dataobject.qchistory.QcHistoryDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.hs.controller.admin.qchistory.vo.*;

/**
 * 物料质检历史记录 Mapper
 *
 * @author 航盛
 */
@Mapper
public interface QcHistoryMapper extends BaseMapperX<QcHistoryDO> {

    default PageResult<QcHistoryDO> selectPage(QcHistoryPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<QcHistoryDO>()
                .eqIfPresent(QcHistoryDO::getWarehouseId, reqVO.getWarehouseId())
                .eqIfPresent(QcHistoryDO::getOperator, reqVO.getOperator())
                .eqIfPresent(QcHistoryDO::getRfidCode, reqVO.getRfidCode())
                .eqIfPresent(QcHistoryDO::getBoxCode, reqVO.getBoxCode())
                .likeIfPresent(QcHistoryDO::getMaterialName, reqVO.getMaterialName())
                .eqIfPresent(QcHistoryDO::getMaterialCode, reqVO.getMaterialCode())
                .eqIfPresent(QcHistoryDO::getMaterialModeCode, reqVO.getMaterialModeCode())
                .eqIfPresent(QcHistoryDO::getQcResult, reqVO.getQcResult())
                .eqIfPresent(QcHistoryDO::getQcOrderCode, reqVO.getQcOrderCode())
                .betweenIfPresent(QcHistoryDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(QcHistoryDO::getId));
    }

}